package cn.iocoder.yudao.module.gov.dal.mysql.resourcedirectory;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.gov.dal.dataobject.resourcedirectory.ResourceDirectoryDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.gov.controller.admin.resourcedirectory.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 政务资源目录 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ResourceDirectoryMapper extends BaseMapperX<ResourceDirectoryDO> {

    default PageResult<ResourceDirectoryDO> selectPage(ResourceDirectoryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ResourceDirectoryDO>()
                .eqIfPresent(ResourceDirectoryDO::getCatalogId, reqVO.getCatalogId())
                .eqIfPresent(ResourceDirectoryDO::getMenuId, reqVO.getMenuId())
                .eqIfPresent(ResourceDirectoryDO::getDataId, reqVO.getDataId())
                .likeIfPresent(ResourceDirectoryDO::getCatalogName, reqVO.getCatalogName())
                .eqIfPresent(ResourceDirectoryDO::getShareProperty, reqVO.getShareProperty())
                .eqIfPresent(ResourceDirectoryDO::getApplyNum, reqVO.getApplyNum())
                .eqIfPresent(ResourceDirectoryDO::getMatterId, reqVO.getMatterId())
                .likeIfPresent(ResourceDirectoryDO::getMatterName, reqVO.getMatterName())
                .eqIfPresent(ResourceDirectoryDO::getMatterCode, reqVO.getMatterCode())
                .likeIfPresent(ResourceDirectoryDO::getDeptName, reqVO.getDeptName())
                .eqIfPresent(ResourceDirectoryDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(ResourceDirectoryDO::getIsPermit, reqVO.getIsPermit())
                .eqIfPresent(ResourceDirectoryDO::getViewNum, reqVO.getViewNum())
                .betweenIfPresent(ResourceDirectoryDO::getDataReportTime, reqVO.getDataReportTime())
                .betweenIfPresent(ResourceDirectoryDO::getDataUpdateTime, reqVO.getDataUpdateTime())
                .eqIfPresent(ResourceDirectoryDO::getIsImputation, reqVO.getIsImputation())
                .eqIfPresent(ResourceDirectoryDO::getMissingStaus, reqVO.getMissingStaus())
                .eqIfPresent(ResourceDirectoryDO::getUnTimelyStatus, reqVO.getUnTimelyStatus())
                .eqIfPresent(ResourceDirectoryDO::getDataFileUpdateTimeUntimely, reqVO.getDataFileUpdateTimeUntimely())
                .betweenIfPresent(ResourceDirectoryDO::getCheckTime, reqVO.getCheckTime())
                .eqIfPresent(ResourceDirectoryDO::getCatalogCode, reqVO.getCatalogCode())
                .eqIfPresent(ResourceDirectoryDO::getTabNumber, reqVO.getTabNumber())
                .eqIfPresent(ResourceDirectoryDO::getFileNumber, reqVO.getFileNumber())
                .eqIfPresent(ResourceDirectoryDO::getApiNumber, reqVO.getApiNumber())
                .eqIfPresent(ResourceDirectoryDO::getBusinessDomain, reqVO.getBusinessDomain())
                .eqIfPresent(ResourceDirectoryDO::getSubjectType, reqVO.getSubjectType())
                .eqIfPresent(ResourceDirectoryDO::getSubjectFeature, reqVO.getSubjectFeature())
                .eqIfPresent(ResourceDirectoryDO::getIndustryClass, reqVO.getIndustryClass())
                .eqIfPresent(ResourceDirectoryDO::getBusinessClass, reqVO.getBusinessClass())
                .eqIfPresent(ResourceDirectoryDO::getManageObjClass, reqVO.getManageObjClass())
                .eqIfPresent(ResourceDirectoryDO::getTopicClass, reqVO.getTopicClass())
                .eqIfPresent(ResourceDirectoryDO::getInfoCategoryClass, reqVO.getInfoCategoryClass())
                .eqIfPresent(ResourceDirectoryDO::getFromSystem, reqVO.getFromSystem())
                .eqIfPresent(ResourceDirectoryDO::getIrfClass, reqVO.getIrfClass())
                .eqIfPresent(ResourceDirectoryDO::getIrfType, reqVO.getIrfType())
                .eqIfPresent(ResourceDirectoryDO::getSrcdb, reqVO.getSrcdb())
                .eqIfPresent(ResourceDirectoryDO::getIrCode, reqVO.getIrCode())
                .likeIfPresent(ResourceDirectoryDO::getTableEnname, reqVO.getTableEnname())
                .eqIfPresent(ResourceDirectoryDO::getIrProvideCode, reqVO.getIrProvideCode())
                .orderByDesc(ResourceDirectoryDO::getCatalogId));
    }

    int deleteAll();

    List<ResourceDirectoryDO> selectPage01List(@Param("pageReqVO") ResourceDirectoryPageReqVO pageReqVO);

    Long  selectPage01Count(@Param("pageReqVO") ResourceDirectoryPageReqVO pageReqVO);
    

    int selectCountExt(Long catalogId);

    void updateResourceDirectoryStatus(@Param("catalogId") Long catalogId, @Param("status") String status);

    void updatePageView(@Param("catalogId") Long catalogId);

    void mergeResourceDirectoryExt(Long catalogId);

    void updateInterface(@Param("catalogId") Long catalogId, @Param("infoId") String infoId);

    List<ResourceDirectoryDO> getInterfacePageList(@Param("pageReqVO")ResourceDirectoryPageReqVO pageReqVO);

    Long getInterfaceCount(@Param("pageReqVO")ResourceDirectoryPageReqVO pageReqVO);

    void toggleCollect(@Param("catalogId") Long catalogId, @Param("userId") Long portalLoginUserId);

}